package com.todo.biz.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author azhebuxing
 * @date 2024/5/7 16:34
 * @description
 */
@Getter
@AllArgsConstructor
public enum AssociateRelationTypeEnum {

    LIKE(1, "LIKE", "点赞"),
    COLLECT(2, "COLLECT", "收藏"),
    BROWSE(3, "BROWSE", "浏览"),

    ;

    private static Map<Integer, AssociateRelationTypeEnum> typeMap = Arrays
            .stream(AssociateRelationTypeEnum.values())
            .collect(Collectors.toMap(AssociateRelationTypeEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static AssociateRelationTypeEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
